package com.itic.appbase.framework.type;

import java.util.HashMap;
import java.util.Map;

import com.itic.appbase.framework.utils.BaseStringUtils;
import com.itic.mall.mobile.msg.vo.MsgVO;

public enum AlertType {
	
	good("good","商品推送"),send("send","发货推送"),pre("pre","预估收益到账"),actual("actual","累计收益到账");
	private String type;
	private String name;
	AlertType(String type, String name) {
		this.type = type;
		this.name = name;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	public static AlertType getMsgType(String type) {
		AlertType msgType = null;
		switch (type) {
		case "good":
			msgType = AlertType.good;
			break;
		case "send":
			msgType = AlertType.send;
			break;
		case "pre":
			msgType = AlertType.pre;
		case "actual":
			msgType = AlertType.actual;
		default:
			break;
		}
		return msgType;
	}
	
	public static  String getAlert(Map<String,Object> params,String template){
		return BaseStringUtils.bracketReplace(template, params);
	}
	
	public static Map<String,Object> getAlertMap(AlertType msgType,MsgVO msgVO){
		Map<String,Object> alertMap = new HashMap<>();
		switch (msgType) {
		case good:
			break;
		case send:
			alertMap.put("goodName", msgVO.getGoodName());
			alertMap.put("orderNo", msgVO.getOrderNo());
			break;
		case pre:
		case actual:
			alertMap.put("money", msgVO.getMoney());
			break;
		}
		return alertMap;
	}
	
	/*public static void main(String[] args) {
		String aa="你的预估收益，收到【{money}】元了，快快去查看！";
		MsgVO msgVO = new MsgVO();
		msgVO.setMoney(100.00);
		Map<String, Object> param  = AlertType.getAlertMap(AlertType.pre, msgVO);
		String alert = AlertType.getAlert(param,aa);
		System.out.println(alert);

	}*/
}
